<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		<div id="app">
			
		</div>
		
		<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/axios.js" type="text/javascript" charset="utf-8"></script>
	
	
		<script type="text/javascript">
			const vue = new Vue({
				el: "#app",
				data: {},
				methods: {
					//1、方法上添加async
					getUserById: async function(){
					 	//之前通过then的方式接收返回值的结果，现在通过await可以直接返回值
						//2、axios上添加await，返回值直接封装到result中
						const {data:result} = await axios.get("http://localhost:8081/user/1")
						console.log(result)
					}
				},
				mounted() {
					this.getUserById();
				}
			})
		</script>
	
	</body>
</html>
